/**
 * 
 */
package com.haisen.lee.domain;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Haisen Lee
 * 
 */
public class ResultNode<T> {

	private Map<String, ResultAttribute<T>> attributes = new HashMap<String, ResultAttribute<T>>();
	private String tag;
	private List<ResultNode<T>> childrenNode = new ArrayList<ResultNode<T>>();
	private boolean traversalFlag;
	private int index;

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	/**
	 * 
	 */
	public ResultNode() {

	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((tag == null) ? 0 : tag.hashCode());
		return result;
	}

	@SuppressWarnings("unchecked")
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ResultNode<T> other = (ResultNode<T>) obj;
		return other.hashCode() == hashCode();
	}

	public Map<String, ResultAttribute<T>> getAttributes() {
		return attributes;
	}

	public boolean isTraversalFlag() {
		return traversalFlag;
	}

	public void setTraversalFlag(boolean traversalFlag) {
		this.traversalFlag = traversalFlag;
	}

	public void setAttributes(Map<String, ResultAttribute<T>> attributes) {
		this.attributes = attributes;
	}

	public String getTag() {
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

	public List<ResultNode<T>> getChildrenNode() {
		return childrenNode;
	}

	public void setChildrenNode(List<ResultNode<T>> childrenNode) {
		this.childrenNode = childrenNode;
	}

}
